bitkeeper revision 1.1257 (424166b1-4aA-sSJbmTizuGjdmiSWg)
authormafetter@fleming.research <mafetter@fleming.research>
Wed, 23 Mar 2005 12:53:05 +0000 (12:53 +0000)
committermafetter@fleming.research <mafetter@fleming.research>
Wed, 23 Mar 2005 12:53:05 +0000 (12:53 +0000)
Don't fully populate the shadow for every L1 we map.
Only populate the demanded entry in the L1, and then from entry 0 up to the
first invalid entry.

Signed-off-by: michael.fetterman@cl.cam.ac.uk
BitKeeper/etc/ignore
xen/arch/x86/shadow.c
xen/include/asm-x86/shadow.h

index a248c75b8c13470b509a30dda166cbd8196423b7..6990f1b2aae96ce04143b82c01237d2308e32d1d 100644 (file)
@@ -101,3 +101,6 @@ xen/tools/figlet/figlet
 xen/xen
 xen/xen-syms
 xen/xen.*
+tools/misc/cpuperf/cpuperf-perfcntr
+tools/misc/cpuperf/cpuperf-xen
+tools/misc/xc_shadow
index 8208382334ec97a85be18273f66109c64bb8c8e2..70fd8a2e9d73de5d89b9c356e84bf0f423453ecc 100644 (file)
@@ -1427,14 +1427,27 @@ void shadow_map_l1_into_current_l2(unsigned long va)
             &(shadow_linear_pg_table[l1_linear_offset(va) &
                                      ~(L1_PAGETABLE_ENTRIES-1)]);
 
+        memset(spl1e, 0, PAGE_SIZE);
+
+        unsigned long sl1e;
+        int index = l1_table_offset(va);
+
+        l1pte_propagate_from_guest(d, gpl1e[index], &sl1e);
+        if ( (sl1e & _PAGE_PRESENT) &&
+             !shadow_get_page_from_l1e(mk_l1_pgentry(sl1e), d) )
+            sl1e = 0;
+        spl1e[index] = sl1e;
+
         for ( i = 0; i < L1_PAGETABLE_ENTRIES; i++ )
         {
-            unsigned long sl1e;
-
+            if ( i == index )
+                continue;
             l1pte_propagate_from_guest(d, gpl1e[i], &sl1e);
             if ( (sl1e & _PAGE_PRESENT) &&
                  !shadow_get_page_from_l1e(mk_l1_pgentry(sl1e), d) )
                 sl1e = 0;
+            if ( sl1e == 0 )
+                break;
             spl1e[i] = sl1e;
         }
     }
index dd4ae21034c3f637af865ac9e674f48a785fec31..4b9d4885738517a638824261f5a07cd2c2b3db79 100644 (file)
@@ -609,14 +609,13 @@ static inline int l1pte_read_fault(
 static inline void l1pte_propagate_from_guest(
     struct domain *d, unsigned long gpte, unsigned long *spte_p)
 { 
-    unsigned long pfn = gpte >> PAGE_SHIFT;
     unsigned long mfn, spte;
 
     spte = 0;
 
     if ( ((gpte & (_PAGE_PRESENT|_PAGE_ACCESSED) ) ==
           (_PAGE_PRESENT|_PAGE_ACCESSED)) &&
-         VALID_MFN(mfn = __gpfn_to_mfn(d, pfn)) )
+         VALID_MFN(mfn = __gpfn_to_mfn(d, gpte >> PAGE_SHIFT)) )
     {
         spte = (mfn << PAGE_SHIFT) | (gpte & ~PAGE_MASK);